<%--
  Created by IntelliJ IDEA.
  User: cmm
  Date: 2025/3/19
  Time: 21:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DeepSeek Chat</title>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@heroicons/outline@1.0.4/solid.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism.min.css" rel="stylesheet" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism-tomorrow.min.css" rel="stylesheet" />
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background-color: #ffffff;
            color: #333333;
            height: 100vh;
            display: flex;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 260px;
            background-color: #f7f7f8;
            display: flex;
            flex-direction: column;
            padding: 12px;
            border-right: 1px solid #e5e5e5;
        }

        .new-chat-btn {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background-color: #ffffff;
            border: 1px solid #e5e5e5;
            border-radius: 6px;
            color: #333333;
            cursor: pointer;
            width: 100%;
            margin-bottom: 20px;
            transition: background-color 0.2s;
        }

        .new-chat-btn:hover {
            background-color: #f0f0f0;
        }

        .chat-list {
            flex: 1;
            overflow-y: auto;
        }

        .chat-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            cursor: pointer;
            border-radius: 6px;
            margin-bottom: 4px;
            position: relative;
            color: #333333;
        }

        .chat-item:hover {
            background-color: #f0f0f0;
        }

        .chat-item.active {
            background-color: #e5e5e5;
        }

        .delete-chat {
            position: absolute;
            right: 12px;
            opacity: 0;
            transition: opacity 0.2s;
            background: none;
            border: none;
            color: #666666;
        }

        .chat-item:hover .delete-chat {
            opacity: 1;
        }

        /* 主要内容区域 */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100vh;
            background-color: #ffffff;
        }

        #chat-container {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            scroll-behavior: smooth;
        }

        .message {
            display: flex;
            padding: 20px;
            gap: 20px;
            border-bottom: 1px solid #f0f0f0;
        }

        .message-avatar {
            width: 30px;
            height: 30px;
            border-radius: 4px;
            background-color: #f0f0f0;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #666666;
        }

        .message-content {
            flex: 1;
            line-height: 1.6;
            color: #333333;
            white-space: pre-wrap;
        }

        .user-message {
            background-color: #f7f7f8;
        }

        .assistant-message {
            background-color: #ffffff;
        }

        #input-container {
            padding: 20px;
            background-color: #ffffff;
            border-top: 1px solid #e5e5e5;
        }

        .input-box {
            max-width: 800px;
            margin: 0 auto;
            position: relative;
        }

        #message-input {
            width: 100%;
            padding: 16px;
            background-color: #ffffff;
            border: 1px solid #e5e5e5;
            border-radius: 6px;
            color: #333333;
            font-size: 16px;
            resize: none;
            min-height: 52px;
            max-height: 200px;
            outline: none;
        }

        #message-input:focus {
            border-color: #2563eb;
        }

        .send-button {
            position: absolute;
            right: 12px;
            bottom: 12px;
            background-color: transparent;
            border: none;
            color: #666666;
            cursor: pointer;
            padding: 4px;
            border-radius: 4px;
        }

        .send-button:hover {
            background-color: #f0f0f0;
        }

        /* 滚动条样式 */
        ::-webkit-scrollbar {
            width: 8px;
        }

        ::-webkit-scrollbar-track {
            background: #f7f7f8;
        }

        ::-webkit-scrollbar-thumb {
            background: #d1d1d1;
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: #c1c1c1;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            body {
                padding: 10px;
            }

            .header h1 {
                font-size: 1.5em;
            }

            #chat-container {
                height: calc(100vh - 180px);
            }

            .message {
                max-width: 95%;
            }
        }

        /* 添加代码块相关样式 */
        .code-block {
            position: relative;
            background: #1e1e1e;
            border-radius: 8px;
            margin: 10px 0;
        }

        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 16px;
            background: #2d2d2d;
            border-top-left-radius: 8px;
            border-top-right-radius: 8px;
            color: #fff;
        }

        .code-language {
            font-size: 12px;
            color: #888;
        }

        .copy-button {
            padding: 4px 8px;
            background: transparent;
            border: 1px solid #666;
            border-radius: 4px;
            color: #fff;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .copy-button:hover {
            background: #666;
        }

        .code-content {
            padding: 16px;
            overflow-x: auto;
        }

        .code-content pre {
            margin: 0;
            background: transparent !important;
        }

        .code-content code {
            font-family: 'Fira Code', monospace;
            font-size: 14px;
            line-height: 1.5;
        }

        /* 加载动画样式 */
        .loading-message {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .loading-dots {
            display: flex;
            gap: 4px;
        }

        .loading-dot {
            width: 8px;
            height: 8px;
            background-color: #666;
            border-radius: 50%;
            animation: pulse 1.5s infinite;
        }

        .loading-dot:nth-child(2) {
            animation-delay: 0.2s;
        }

        .loading-dot:nth-child(3) {
            animation-delay: 0.4s;
        }

        @keyframes pulse {
            0%, 100% {
                opacity: 0.3;
                transform: scale(0.8);
            }
            50% {
                opacity: 1;
                transform: scale(1);
            }
        }
    </style>
</head>
<body>
<div class="sidebar">
    <button class="new-chat-btn" onclick="createNewChat()">
        <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
            <path d="M12 4V20M4 12H20" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
        </svg>
        新建对话
    </button>
    <div class="chat-list" id="chat-list">
        <!-- 对话列表将通过JavaScript动态生成 -->
    </div>
</div>
<div class="main-content">
    <div id="chat-container"></div>
    <div id="input-container">
        <div class="input-box">
            <textarea id="message-input" placeholder="输入消息..." rows="1" onInput="autoResize(this)"></textarea>
            <button class="send-button" onclick="sendMessage()">
                <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
                    <path d="M4 12L20 4L12 20L10 14L4 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
            </button>
        </div>
    </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="app.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/components/prism-python.min.js"></script>
</body>
</html>
